import { defineStore } from "pinia";
import store from "@/store";
import { setToken } from "@/utils/tokenTools";

export const useUserStore = defineStore("user", () => {
  const userInfo = ref<any>({});

  const getUserInfo = () => {};

  const logout = () => {
    setToken("");
    location.reload();
  };

  return {
    userInfo,
    getUserInfo,
    logout,
  };
});

// 在setup外使用
export function useUserStoreHook() {
  return useUserStore(store);
}
